package de.baumann.browser.views.dialog

import android.content.Context
import android.widget.Toast
import de.baumann.browser.R
import kotlinx.android.synthetic.main.dialog_update_wallet_name.*

class UpdateWalletNameDialog(context: Context, var callback: Callback) : BaseDialog(context) {
    override fun laoutId(): Int {
        return R.layout.dialog_update_wallet_name
    }

    override fun initView() {
        tvuwnc.setOnClickListener {
            dismiss()
        }

        tvuwno.setOnClickListener {
            val name = edUWN.text.toString().trim()
            if (name.isEmpty()) {
                Toast.makeText(context, "请输入钱包名称", Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
            dismiss()
            callback.callback(name)
        }
    }

    interface Callback {
        fun callback(name: String)
    }

}